<?php
header("Content-type:text/html;charset:utf-8");
require 'config_db.php'; //顺序不能乱
require 'db_connect_fn.php';
$data = query("select * from class");
?>
<h1>
      <a href="add.php">添加班级</a>
</h1>
<table width="400" border="1">
      <?php foreach ($data as $field): ?>
            <tr>
                  <td>
                        <?php echo $field["cname"]; ?>&nbsp;&nbsp;&nbsp;
                        <a href="edit.php?cid=<?php echo $field['cid'];?>">编辑</a>&nbsp;|&nbsp;                 
                        <a href="del.php?cid=<?php echo $field['cid'];?>">删除</a>
                  </td>
                  
            </tr>
      <?php endforeach; ?>
</table>